<template>
    <div class="flow-leave-dialog-container">
        <el-dialog :title="state.dialog.title" v-model="state.dialog.isShowDialog" width="60%">
        <el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
          <el-table-column label="序号" width="50" align="center" key="id" prop="id">
            <template #default="scope">
              {{ scope.$index + 1 }}
            </template>
          </el-table-column>
          <el-table-column label="开始节点名称" align="center" prop="nodeName" :show-overflow-tooltip="true"/>
          <el-table-column label="结束节点名称" align="center" prop="targetNodeName" :show-overflow-tooltip="true"/>
          <el-table-column label="审批人" align="center" prop="approver" :show-overflow-tooltip="true"/>
          <el-table-column label="协作类型" align="center" prop="cooperateType" :show-overflow-tooltip="true">
            <template #default="scope">
              <dict-tag :options="cooperate_type" :value="scope.row.cooperateType"/>
            </template>
          </el-table-column>
          <!-- <el-table-column label="协作人" align="center" prop="collaborator" :show-overflow-tooltip="true"/> -->
          <el-table-column label="流程状态" align="center" prop="flowStatus" :show-overflow-tooltip="true">
            <template #default="scope">
              <dict-tag :options="flow_status" :value="scope.row.flowStatus"/>
            </template>
          </el-table-column>
          <el-table-column label="审批意见" align="center" prop="message" :show-overflow-tooltip="true"/>
          <el-table-column label="创建时间" align="center" prop="createTime" width="160" :show-overflow-tooltip="true">
            <template #default="scope">
              <span>{{ parseTime(scope.row.createTime) }}</span>
            </template>
          </el-table-column>
      </el-table>
            </el-dialog>
  </div>
</template>

<script setup lang="ts" name="DoneList">
import { doneList } from '/@/api/flow/execute'
import constConfig from '/@/utils/constConfig';

const { proxy } = <any>getCurrentInstance();
const { flow_status, cooperate_type } = proxy.useDict('flow_status', 'cooperate_type');

const state = reactive({
        dialog: {
            isShowDialog: false,
            type: '',
            title: '审批记录',
            submitTxt: '',
        },
        tableData: {
          data: [],
          total: 0,
          loading: false,
          param: {
            username:'',
            ...constConfig.pageModel,
          },
        },
    });


const openDialog = (instanceId:string) => {
  doneList(instanceId).then(response => {
    state.dialog.isShowDialog = true;
    state.tableData.data = response.data;
  });
};
defineExpose({
	openDialog,
});
</script>
